package com.tec.cloud.notice.service;

import com.github.jaemon.dinger.DingerSender;
import com.github.jaemon.dinger.core.entity.DingerRequest;
import com.github.jaemon.dinger.core.entity.enums.MessageSubType;
import org.springframework.stereotype.Service;

@Service
public class NoticeService {

    private DingerSender dingerSender;

    public NoticeService(DingerSender dingerSender) {
        this.dingerSender = dingerSender;
    }

    public void sendTextMessage(String message) {
        // 发送text类型消息
        dingerSender.send(
                MessageSubType.TEXT,
                DingerRequest.request(message)
        );


    }

    public void sendMarkDownMessage(String title, String message) {
        // 发送markdown类型消息
        dingerSender.send(
                MessageSubType.MARKDOWN,
                DingerRequest.request(message, title)
        );
    }
}
